package com.ablecloud.demo;

public class LightMsg {
    public static final int CODE = 68;
    public static final int RESP_CODE = 102;
    public static final int REPORT_CODE = 203;

    public static final String KEY_SWITCH = "switch";
    public static final String KEY_SOURCE = "source";

    
  //0代表关，1代表开
    public static final byte ON = 1;
    public static final byte OFF = 0;
    //控制类型，0代表app控制，1代表物理开关控制
    public static final byte FROM_APP = 0;
    public static final byte FROM_SWITCH = 1;
    //开关状态
    private int ledOnOff;
    //操作来源
    //private byte source;

    public LightMsg(byte[] payload) {
        String tString = Integer.toBinaryString((payload[0] & 0xFF) + 0x100).substring(1);
        this.ledOnOff=Integer.valueOf(String.valueOf(tString.charAt(0)));
    }

    public int getLedOnOff() {
        return ledOnOff;
    }

    /*public byte getSource() {
        return source;
    }*/
}
